﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.IO;

using LuaInterface;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace CodeGame.LuaLibary
{
    static class luaLib_global
    {

        [LuaHelpAttribute("Prints any object using it's C# tostring method")]
        public static void print(object obj)
        {
            try
            {
                Singletons.Console.Print(obj.ToString(), Singletons.NormalText);
            }
            catch (Exception ex)
            {
                Singletons.Console.Print(ex.Message, Singletons.ErrorText);
            }
        }

        [LuaHelp("Same as the print function but allows you to pass the color")]
        public static void printc(object obj, int r, int g, int b)
        {
            try
            {
                Singletons.Console.Print(obj.ToString(), new Color(r,g,b));
            }
            catch (Exception ex)
            {
                Singletons.Console.Print(ex.Message, Singletons.ErrorText);
            }
        }

        [LuaHelp("Lists help for one single function passed as a string")]
        public static void help(string str)
        {
            if (Singletons.LuaHelp.ContainsKey(str))
            {
                Singletons.Console.Print(Singletons.LuaHelp[str], Singletons.NormalText);
            }
            else
            {
                Singletons.Console.Print("Help Topic does not Exist", Singletons.ErrorText);
            }
        }

        [LuaHelp("Exits the Game")]
        public static void exit()
        {
            Environment.Exit(0);
        }

        [LuaHelp("Toggles the console to be mini sized or full sized")]
        public static void toggle()
        {
            Singletons.Console.Toggle();
        }

    }
}
